﻿@{
    string hospitalId = ViewData["HospitalID"].ToString();
    string hospitalname = ViewData["HospitalName"].ToString();// (ViewBag.Hospitals as IEnumerable<string>).FirstOrDefault();
    var hospitalitem = (Hospital)ViewData["hospitalitem"];
    bool userCanSubmit = (bool)ViewData["userCanSubmit"];
    var Subjects = ViewData["Subjects"] as IEnumerable<QizSubject>;
    var QizSessions_Of_Recuper = ViewData["QizSessions_Of_Recuper"] as IEnumerable<QizSession>;
}
<div id="@hospitalId" class="hospital-home" style="min-height: 820px;display:none;">
    <div style="float: right; width: 240px; margin: 12px; margin-top: 0px;">
        @{var cmsgp = hospitalitem.CmsCatalogs.FirstOrDefault(v => v.TypeFlag == "CMS");}
        @if (cmsgp != null)
        {
        <div class="cms-group-title">
            [@cmsgp.Title]
        </div>
        <div class="cms-group-content">
            @foreach (var cata in cmsgp.SubCmsCatalogs.OrderByDescending(v => v.SortIdx))
            {
                <h3 class="cms-cata-title">[@cata.Title]</h3>
                <div class="cms-cata-content">
                    @foreach (var item in cata.CmsItems.OrderByDescending(v => v.SortIdx))
                    {
                        <div class="cms-item" title="@item.Title">
                            @Html.ActionLink((string.IsNullOrEmpty(item.TitleShort) ? item.Title : item.TitleShort), "Index", "Cms", new { ID = item.ID }, new { target = "_blank" })
                        </div>
                    }
                </div>
            }
        </div>
        }
        @{cmsgp = hospitalitem.CmsCatalogs.FirstOrDefault(v => v.TypeFlag == "LINKS");}
        @if (cmsgp != null)
        {
        <div class="cms-group-title">
            [@cmsgp.Title]
        </div>
        <div class="cms-cata-content">
            @foreach (var item in cmsgp.CmsItems.OrderByDescending(v => v.SortIdx))
            {
                <div class="cms-item" title="@item.Title">
                    <a href="@item.TextContent" target="_blank">
                        @(string.IsNullOrEmpty(item.TitleShort) ? item.Title : item.TitleShort)
                    </a>
                </div>
            }
        </div>
        }
        <div class="cms-group-title">
            [联系方式]
        </div>
        <div class="cms-cata-content">
            <br />
            <a href="@Url.Content("~/Content/SiteImages/3ab.qr.full.png")" style="border:none;" target="_blank">
                <img align="bottom" width="128px" height="128px" alt="" src="@Url.Content("~/Content/SiteImages/3ab.qr.lite.png")" /></a><br />
            三爱随访（微信号：sky3ab)<br />
            @*            电子邮件：<a href="mailto:sky3ab@163.com" target="_blank">SKY3AB@163.COM</a><br />*@
        </div>
    </div>
    <ul class="stacklist" style="text-align: left;">
        @foreach (var m in Subjects.Where(v => v.Hospital.HospName == hospitalname).OrderByDescending(v => v.SortIdx))
        {
            <li style="text-align: left; margin: 20px; width: 390px; border: none; box-shadow: none;">
                @Helpers.Shadowbox(
            @<table class="width" @(userCanSubmit ? "" : "disabled='disabled'")>
                <tr>
                    <td width="120px">
                        <a onclick="window.open(this.href,'_self');" @(userCanSubmit ? "href=" + Url.Action("QizSessionEdit", new { SubjectID = m.ID }) : "")  class="bigheartbg @(userCanSubmit ? "bigheartbg-red" : "bigheartbg-gray")">
                            <table class="width noborder" height="120px">
                                <tr>
                                    <td height="80px"></td>
                                </tr>
                                <tr>
                                    <td valign="middle" align="center">
                                        <h3>立即参与随访</h3>
                                    </td>
                                </tr>
                            </table>
                        </a>
                    </td>
                    <td>
                        <table class="width">
                            <tr>
                                <th colspan="2">
                                    <span>@Html.DisplayFor(modelItem => m.Title)</span>
                                </th>
                            </tr>
                            <tr>
                                <td colspan="2">医院：<span>@Html.DisplayFor(modelItem => m.Hospital.HospName) </span>
                                </td>
                            </tr>
                            <tr>@*科室是bingqu,病区是dep----这是对的*@
                                <td>科室：@Html.DisplayFor(modelItem => m.Department.BingQu.Title)
                                </td>
                                <td>病区：@Html.DisplayFor(modelItem => m.Department.DepName)
                                    @*@string.Join(",",m.QizSubjectObjForDoctors.Where(v=>v.RecuperID==SiteUser.UserId).Select(v=>v.Doctor.UserName).ToArray())*@
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">上次填报：@Helpers.DateTimeString(QizSessions_Of_Recuper.Where(v => v.QizSubjectID == m.ID).OrderByDescending(v => v.CreationTime).Select(v => v.CreationTime).FirstOrDefault())
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td style="border: none; white-space: normal; height: 60px;" colspan="2" valign="top"
                        align="left">
                        @Html.DisplayFor(modelItem => m.DescForRecuper)
                    </td>
                </tr>
            </table>
                )
            </li>
        }
        @if (Subjects.Count() % 2 == 1)
        { <li style="text-align: left; margin: 20px; width: 390px; border: none;"></li>}
    </ul>
</div>
